home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Full
/
Paragon Drive Backup 9
/
DB90_SE_x32.msi
/
Data1.cab
/
_1AD9F7397786BBEA2F9EDC57DE1DCFD6
< prev
next >
Wrap
Text File
|
2008-06-28
|
14KB
|
433 lines
Incremental Backup
Contents
1. Overview
2. Incremental Backup
2.1 N-incremental backup script
2.2 Intelligent Incremental Backup script
3. Examples of the scripts for incremental backups
3.1 N-incremental backup script
3.2 Intelligent Incremental Backup script
4. How to execute scripts
5. Limitations
5.1 For N-incremental backup script
5.2 For Intelligent Incremental Backup script
1. Overview
Incremental Backup provides the ability of archiving only those changes in partition's contents,
which were made since its last backup. Such archives usually take much less disk space.
To perform the Incremental Backup of a partition, the program requires use a previously made archive
of this partition. The previous backup image is named the Basic Archive or the Basic Backup Image.
The program produces the exact comparison of the previous partition's data (that are saved in the basic
image) with the current ones (that is actually the partition itself). The difference in contents is
saved in the newly created incremental backup archive. An incremental backup archive cannot be used
detached from its basic image.
Incremental Backup is currently enabled only for single Primary and Logical partitions.
2. Incremental Backup
As incremental backups should be performed on regular basis, we supose, that resulting script will be scheduled.
We offer you two variants of incremental backups.
2.1 N-incremental Backup script
The script creates Basic Archive and then creates N-incremental backup images (value of "N" can be changed)
during subsequent launches. When "N"-incremental backup images are created, the script deletes all archives
(Basic Archive+"N" incremental) and creates new base archive.
Then the cycle repeats.
2.2 Intelligent Incremental Backup script
The script doesn't creates Basic Archive, the user should create it manually. During subsequent launches it creates
incremental backup images while there is enough free space on target partition. When partition is filled up, the script
deletes as many incremental backup images (from a list of oldest) as required for creating new incremental backup.
3. Examples of the scripts for incremental backups
3.1 N-incremental Backup script
Neccessary variables, which you should customize:
* ndisk - number of disk with which we want to work (0-based numeration of hard disks)
* npart - number of partition which we want backup (0-based numeration of partitions)
* nsavedisk - number of disk on which we will backup (0-based numeration of hard disks)
* nsavepart - number of partition on which we will backup (0-based numeration of partitions)
* narchs - maximum number of incremental backups
* "backup.pbf"/"backup" - where "backup" - is the name of backup archive, which can be customized
Script body:
=====================================================================================================================
/*
* This script creates incremental backups
* If quantity of incremental backups more than specified number
* than this script deletes all incremental backups and creates
* simple backup
*/
// Turn off all questions and confirmations
confirm off
// Print some text
print "Clever backup of partition"
print ""
/*
* Set some variables:
* ndisk - number of disk with which we want to work
* npart - number of partition which we want backup
* nsavedisk - number of disk on which we will backup
* nsavepart - number of partition on which we will backup
* narchs - maximum number of incremental backups
*/
set value ndisk = 0
set value npart = 1
set value nsavedisk = 0
set value nsavepart = 2
set value narchs = 10
// Setting header for filename: "/hard<N1>/partition<N2>/"
set string header = "/hard" + stringdec(value(nsavedisk)) + "/partition"
+ stringdec(value(nsavepart)) + "/"
// Sets file counter to 0
set value counter = 0
if (not(fileexist(string(header) + "backup.pbf")))
then
set value counter = value(narchs)
endif
/*
* Next some lines searches latest backup of partition
* We simply check existing of files with
* predefined filenames
*/
jump:
if (fileexist(string(header) + "backup" + stringdec(value(counter)) + ".pbf"))
then
set value counter = value(counter) + 1
goto jump
endif
// Ok, in counter we have number of files
if (value(counter) < value(narchs))
then
set value need_additional = 0
endif
else
set value need_additional = 1
endelse
if (value(need_additional) != 1)
then
// Incremental backup
print "Incremental backup of partition"
print ""
// Select filename for image
img = string(header) + "backup" + stringdec(value(counter)) + ".pbf"
base = string(header) + "backup.pbf"
unselect all
select disk value(ndisk) // Select disk
select partition value(npart) // Select partition
options
cmp = 1 // Compression = 1
label = "Incremental backup" // Label
increment = "" // Password to base archive
autonames // Create names automatically
store // Backup
call something_do // Check last operation
apply all // Apply all scheduled operations
call something_do // Check last operation
goto out // Exit
endif
// If we are here we need to do additional backup
// But we need to delete all files before
set value counter = 0 // Sets file counter to 0
// Delete all files
jump1:
set string name_of_file = string(header) + "backup" + stringdec(value(counter)) + ".pbf"
if (fileexist(string(name_of_file)))
then
filedelete(string(name_of_file))
set value counter = value(counter) + 1
goto jump1
endif
print "Additional backup of partition"
print ""
img = string(header) + "backup.pbf" // Select filename for image
unselect all
select disk value(ndisk) // Select disk
select partition value(npart) // Select partition for backup
options
cmp = 1 // Compression = 1
label = "Additional backup" // Label
autonames // Create names automatically
store // Backup
call something_do // Check last operation
apply all // Apply all scheduled operations
call something_do // Check last operation
goto out // Exit
something_do: // Procedure for checking last operation
if (errorcode(1) != 0) // If we have error
then
print "Some error occured: " // Print message
strerror(errorcode(1)) // Print explanation of error
print ""
print "Exiting"
print ""
exit(errorcode(1)) // Exit from script
endif
endcall // End of procedure
out:
print "************************************** ALL IS OK **************************"
print ""
exit(0)
=====================================================================================================================
This script can be find into "..Drive Backup 7.0 Server Edition\scripts\Nincremental.psl"
After first launch the script creates backup archive "backup.pbf" (or "<name.pbf>" if you set your own name).
During subsequent launches it creates "backup01.pbf", "backup02.pbf".."backup0N.pbf".
3.2 Intelligent Incremental Backup script
Neccessary variables, which you should customize:
* ndisk - number of disk with which we want to work (0-based numeration of hard disks)
* npart - number of partition which we want backup (0-based numeration of partitions)
* pathb - path to Basic Archive
* pathi - path to incremental backup
Script body:
=====================================================================================================================
/*
Script does new incrementals till there is enough space.
Then deletes the oldest incremental.
*/
set value ndisk = 0 // source disk number
set value npart = 0 // source partition number
set string pathb = "e:/img.pbf" // Basic backup image
set string pathi = "e:/incremental" // Subfolder with incrementals
confirm off
if (not(fileexist(string(pathb)))) // Checking for basic backup image
then
print "Basic image isn't found"
print ""
print "Exiting"
print ""
exit(1)
endif
set value crtime = nowtime
set string funame = "img" + stringdec(value(crtime)) + ".pbf"
base = string(pathb) // Estimating
img = string(pathi)+"/"+string(funame)
unselect all
select disk value(ndisk)
select partition value(npart)
options
cmp = 1
label = "Incremental backup"
increment = ""
autonames
estimation (2,tnow)
store
printdec value(tnow)/1024
print " Mb required for incremental backup file"
print ""
for all disks
for all partitions
if (mount(curdisk, curpartition) == substring(string(pathi),0,1))
then
set variable "tpartition"
endif
endfor
endfor
select partition variable "tpartition"
print stringdec(sizefree(curdisk, curpartition)/1024) +" Mb available"
print ""
set value fsize = value(tnow) - sizefree(curdisk, curpartition)
if (value(fsize) > 0)
then
goto free_sp
endif
// Saving incremental
star:
base = string(pathb)
img = string(pathi)+"/"+string(funame)
unselect all
select disk value(ndisk)
select partition value(npart)
options
cmp = 1
label = "Incremental backup"
increment = ""
autonames
store
call check_err
apply all
call check_err
print "Backup is successful:" + string(funame) + " created."
print ""
goto out
free_sp: // Deleting the oldest incremental
print "Deleting old incremental..."
print ""
once_again:
set string dname = ""
set string fname = ""
set value oldest = 2999999999
set value a = 0
set value b = dircontents(string(pathi))
if (value(b)==0)
then
goto pipka
endif
ark:
set string fname = direlement(string(pathi),value(a))
if (stringlength(string(fname)) != 17) //Our files' names are 17 chars long :)
then
print "Alien file in the folder !"
print ""
goto hohma
endif
set string tstr = substring(string(fname),3,10) //Looking for the oldest
call ss
if (value(tnew)<value(oldest))
then
set string dname = string(fname)
set value oldest = value(tnew)
endif
hohma:
set value a = value(a) + 1
if (value(a)<value(b))
then
goto ark
endif
pipka:
if (value(oldest)==2999999999) //If we didn't find any incrementals to delete
then
print "Sorry, but there is nothing to delete."
print ""
exit(2)
endif
print string(dname)
print " will be deleted"
print ""
set value fsize = value(fsize) - filesize(string(pathi)+"/"+string(dname))
filedelete(string(pathi)+"/"+string(dname)) //Deleting incremental and its .pfm
filedelete(string(pathi)+"/img"+stringdec(value(oldest))+".pfm")
if (value(fsize) > 0)
then
goto once_again
endif
goto star
// Checking for errors procedure
check_err:
if (errorcode(1) != 0)
then
print "Some error occured: "
strerror(errorcode(1))
print ""
print "Exiting"
print ""
exit(errorcode(1))
endif
endcall
// Procedure for converting string into decimal number
// tstr - string, tnew - number.
ss:
set value tnew = 0
set value len = stringlength(string(tstr))
set value z = 1
d:
set value len = value(len) - 1
set value tnew = value(tnew) + ( (chartocode(substring(string(tstr),value(len),1))-48))*value(z)
set value z = value(z)*10
if (value(len)>0)
then
goto d
endif
endcall
out:
print "************************************** ALL IS OK **************************"
print ""
exit(0)
=====================================================================================================================
This script can be find into "..Drive Backup 7.0 Server Edition\scripts\iincremental.psl"
4. How to schedule scripts
There are two ways: you can run them manyally or on regular basis, using scheduled tasks.
Manually:
- open command line prompt ("Start"->"Run"->type "cmd"->"OK")
- execute following command:
<path_to_scripts.exe>\scripts.exe [-parameters] <path_to_script>\script.psl
"scripts.exe" placed where the program executable files are located. For Windows version, they will
appear in the "\Program" subfolder of the program's installation folder (usually "C:\Program Files\
Paragon Software\Drive Backup 7.0 Server Edition\Program");
Scheduled task:
Run built-in Windows Scheduler
(Start->Programs->Accessories->System Tools->Scheduled Tasks)
- double click "Add Scheduled Task"
- click "Next"
- in the appeared dialog of choosing program, click "Browse"
- find "scripts.exe" ("C:\Program Files\Paragon Software\Drive Backup 7.0 Server Edition\Program\
scripts.exe")
- on the last dialog window, select "Open advanced properties"
- in th appeared dialog window, select string "Run", after quotes put a blank and enter name of
the script.(For example:
"C:\Program Files\Paragon Software\Drive Backup 7.0 Server Edition\Program\scripts.exe" -Wno --alternate
--graph "C:/Program Files/Paragon Software/Drive Backup 7.0 Server Edition/scripts/Nincremental.psl")
5. Limitations
5.1 For N-incremental Backup script
1. You can't use mapped network drive as target partition for incremnental backup script
5.2 For Intelligent Incremental Backup script
1. You can't use mapped network drive as target partition for incremnental backup script